package br.com.view;

import java.util.Calendar;

import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.TextView;
import android.widget.Toast;
import br.com.control.Policy;
import br.com.model.ServicoEquipar;

@SuppressLint({ "ShowToast" })
public class Agendamento extends Activity implements ServicoEquipar,
		View.OnClickListener {
	static final int DATE_DIALOG_ID = 0;
	private static final String URL = "http://192.168.0.10:8080/axis2/services/LoginSoap?wsdl";
	private String METHOD_NAME = "ValidaLogin";
	private String NAMESPACE = "http://view.soap.com.br";
	private String SOAP_ACTION = "LoginSoap";
	private Button botao;
	private int day;
	private DatePicker dp = null;
	private DatePickerDialog mDatePickerDialog;
	private DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener() {
		public void onDateSet(DatePicker paramDatePicker, int paramInt1,
				int paramInt2, int paramInt3) {
			String str = String.valueOf(paramInt3) + " /"
					+ String.valueOf(paramInt2 + 1) + " /"
					+ String.valueOf(paramInt1);
			Toast.makeText(Agendamento.this, "DATA = " + str, 0).show();
		}
	};
	private int month;
	private TextView tvDisplayDate;
	private TextView tvDt;
	private int year;

	@TargetApi(11)
	public void Agenda(View paramView) {
		if ((paramView.getId() != 2131296259)
				&& (paramView.getId() == 2131296260))
			startActivity(new Intent(this, Logar.class));
	}

	public void ChamaTela() {
		startActivity(new Intent(this, Agendamento.class));
	}

	public void MensagemLink() {
		AlertDialog.Builder localBuilder = new AlertDialog.Builder(this);
		localBuilder.setTitle("Solicitação de Agendamento");
		localBuilder.setMessage("Adicionar a mensagem aqui.");
		localBuilder.setNeutralButton("Ok", null);
		localBuilder.show();
	}

	public SoapPrimitive ServicoSoap(String paramString1, String paramString2) {
		try {
			SoapObject localSoapObject = new SoapObject(paramString1,
					paramString2);
			SoapSerializationEnvelope localSoapSerializationEnvelope = new SoapSerializationEnvelope(
					110);
			localSoapSerializationEnvelope.dotNet = true;
			localSoapSerializationEnvelope.setOutputSoapObject(localSoapObject);
			new HttpTransportSE(
					"http://192.168.0.10:8080/axis2/services/LoginSoap?wsdl")
					.call(this.SOAP_ACTION, localSoapSerializationEnvelope);
			SoapPrimitive localSoapPrimitive = (SoapPrimitive) localSoapSerializationEnvelope
					.getResponse();
			return localSoapPrimitive;
		} catch (Exception localException) {
			localException.printStackTrace();
			System.out.println("Error: " + localException.getMessage());
		}
		return null;
	}

	public void TelaHome(View paramView) {
		if (paramView.getId() == 2131296272)
			startActivity(new Intent(this, Logar.class));
	}

	public void onClick(View paramView) {
		if (paramView == this.botao)
			showDialog(0);
	}

	@TargetApi(9)
	public void onCreate(Bundle paramBundle) {
		super.onCreate(paramBundle);
		setContentView(2130903040);
		this.botao = ((Button) findViewById(2131296259));
		this.botao.setOnClickListener(this);
		new Policy().StrictMode();
	}

	protected Dialog onCreateDialog(int paramInt) {
		Calendar localCalendar = Calendar.getInstance();
		int i = localCalendar.get(1);
		int j = localCalendar.get(2);
		int k = localCalendar.get(5);
		switch (paramInt) {
		default:
			return null;
		case 0:
		}
		return new DatePickerDialog(this, this.mDateSetListener, i, j, k);
	}
}
